<?php
/**
 * Created by PhpStorm.
 * User: teddy
 * Date: 16-1-21
 * Time: 上午11:46
 */


/*数据库链接*/
$mysqli = new mysqli('192.168.2.191','root','pwd','SITEMAPTEST');
/*Sql语句*/
$sql = "SELECT DATE_FORMAT(datetime,'%Y-%m-%d') as day,count(*) as count, status  FROM SITEMAPTEST.SiteURLCheck where DATE_SUB(CURDATE(), INTERVAL 14 DAY) <= datetime group by status, day order by day desc,status desc";
//$sql = "select * from APITEST.highcharts_php";
/*设置UTF8*/
$mysqli->query("set character set 'utf8'");
$mysqli->query("set names 'utf8'");
/*取数据*/
$results = $mysqli->query($sql);

/*把数据放在Array中*/
while($row = $results->fetch_assoc())
{
    echo $row['day'] . "\t" . $row['status'] . "\t" . $row['count'] . "\n";
}


/*释放资源*/
$results->free();

/*关闭链接*/
$mysqli->close();